package com.example.myapplication.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;
import android.widget.Toast;

import com.example.myapplication.R;
import com.example.myapplication.adapter.UserListAdapter;
import com.example.myapplication.bean.UserModel;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.ViewById;

@EActivity(R.layout.activity_list_demo)
public class ListDemoActiviy extends AppCompatActivity {

    @ViewById
    ListView listView;

    @Bean
    UserListAdapter adapter;

    @AfterViews
    public void bindAdapter() {
        listView.setAdapter(adapter);
    }

    @ItemClick(R.id.listView)
    public void ItemCLick(UserModel userModel) {
        Toast.makeText(this, "点击对象值为："+userModel.toString(),
                Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}
